package com.star.dto;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.star.domain.Shop;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Classname FlowloadUtils
 * @Author Star
 * @Date 2021/5/3 - 22:05
 * @Description
 */
public class FlowloadUtils {
    /*
     *总页数=（总数-1）/每页数量+1
     * 总页数=（总数+每页数量-1）/每页数量
     */
    public static <T> HashMap<String, Object> buildResult(IPage<T> page, Object datas) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", 200);
        result.put("msg", "ok");
        //总页数
        result.put("pages", page.getPages());
        //数据
        result.put("data", datas);
        return result;
    }

}
